<?php	
	require_once('../../lib/'.'BaseDir.inc.htm');
	require_once (EIU_LIB.'View.class.htm');
	require_once(EIU_LIB.'DBCommon.class.htm');
	require_once (EIU_CLASS.'IOClass.htm');	
	require_once (EIU_CLASS.'DetailIOClass.htm');
	require_once (EIU_CLASS.'CusClass.htm');
	
	
	$ioObj = new io_class();
	$detailObj = new detailIO_class();
	$cusObj = new cus_class();
	
	$IOCode=$_POST["IOCode"];	
			
	//lay thong tin phieu nhap xuat dua tren IOCode
	$ioInfo=$ioObj->getIOInfo_IOCode($IOCode);
	$data["dataSearch"]["ioInfo"] = $ioInfo;
	
	//Lay thong tin cua chi tiet cua phieu xuat nhap
	$detailInfo=$detailObj->getDetailList($IOCode);
	$data["dataSearch"]["detailInfo"] = $detailInfo;
	
	//Lấy danh sách khách hàng
	$cusObj = new cus_class();
	$cusList = $cusObj->getCusList();
	$len = 	count($cusList);
	for($i=0;$i<$len;$i++)
	{
		$data["dataSearch"]["cusList"][$i]["CusID"] = $cusList[$i]->{"CusID"};
		$data["dataSearch"]["cusList"][$i]["ComName"] = $cusList[$i]->{"ComName"};
		$data["dataSearch"]["cusList"][$i]["ComAddress"] = $cusList[$i]->{"ComAddress"};
		$data["dataSearch"]["cusList"][$i]["ComTel"] = $cusList[$i]->{"ComTel"};
		$data["dataSearch"]["cusList"][$i]["ComFax"] = $cusList[$i]->{"ComFax"};
		$data["dataSearch"]["cusList"][$i]["ParentID"] = $cusList[$i]->{"ParentID"};
		$data["dataSearch"]["cusList"][$i]["BankName"] = $cusList[$i]->{"BankName"};
		$data["dataSearch"]["cusList"][$i]["BankCN"] = $cusList[$i]->{"BankCN"};
		$data["dataSearch"]["cusList"][$i]["BankAcc"] = $cusList[$i]->{"BankAcc"};
		$data["dataSearch"]["cusList"][$i]["ParentName"] = $cusList[$i]->{"ParentName"};			
		
	}
	
	$json = json_encode($data["dataSearch"]);	
	echo $json;	
?>